// question : 使用flowRight修改数组中的name值
const fp = require('lodash/fp')

const cars = [
    {price:1001,name:'Audi A4L'},
    {price:1002,name:'Audi A5'},
    {price:1003,name:'Audi A6L'},
    {price:1004,name:'Audi A7'},
    {price:1005,name:'Audi A8L'},
]

let _underscore =fp.replace(/\W+/g,'_')

const fn_replace = (names) =>{
    return names.map(t=>_underscore(t))
}
const fn_toLowerCase = (names)=>{
    return names.map(t=>t.toLowerCase())
}
const fn_getNames = (arr) => {
    return arr.map(t=>t.name)
}
let t = fp.flowRight(fn_replace,fn_toLowerCase,fn_getNames)
console.log(t(cars))
// [ 'audi_a4l', 'audi_a5', 'audi_a6l', 'audi_a7', 'audi_a8l' ]